//
//  BIZConsultorIntroductionCell.m
//  biz
//
//  Created by zhangfuwei on 2017/4/11.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "BIZConsultorIntroductionCell.h"
#import "BIZConsultorDetailModel.h"

@implementation BIZConsultorIntroductionCell{
    
    UIImageView *_iconImgV;
    UILabel     *_titleLabel;
    UIButton    *_moreButton;
    UILabel     *_contentLabel;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self loadUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;

    }
    return self;
}

- (void)loadUI {
    
    _iconImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"consultor_education"]];
    _titleLabel = [[UILabel alloc] init];
    _moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _contentLabel = [[UILabel alloc] init];
    
    _contentLabel.numberOfLines = 0;
    _titleLabel.text = @"咨询师简介";
    
    _titleLabel.font    = CHINESE_SYSTEM(15);
    _contentLabel.font  = CHINESE_SYSTEM(14);
    
    [_moreButton setBackgroundImage:[UIImage imageNamed:@"unfold"] forState:UIControlStateNormal];
    
    [self.contentView addSubview:_iconImgV];
    [self.contentView addSubview:_titleLabel];
    [self.contentView addSubview:_moreButton];
    [self.contentView addSubview:_contentLabel];

    
    [_iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.top.equalTo(self.contentView).offset(8);
        make.width.height.equalTo(@25);
    }];
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_iconImgV.mas_right).offset(10);
        make.top.equalTo(self.contentView).offset(10);
        make.height.equalTo(@20);
    }];
    
    [_moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-10);
        make.top.equalTo(_titleLabel);
        make.height.equalTo(@10);
        make.width.equalTo(@13);
    }];
    
    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.bottom.equalTo(self.contentView).offset(-10);
        make.top.equalTo(_titleLabel.mas_bottom).offset(20);
    }];

}


-(void)setDetailM:(BIZConsultorDetailModel *)detailM {
    _detailM = detailM;
    _contentLabel.text = detailM.honor?:@"摘要：据外媒报道，英国一名收藏家花3.7万美元在网上购得一辆旧坦克，没想到这个收藏给他带来了意外收获。米德说：“我们不知道怎么办，因为不可能就这样拿着5块金锭去卖，所以我们报了警。\n中新网4月10日电 据外媒报道，英国一名收藏家花3.7万美元在网上购得一辆旧坦克，没想到这个收藏给他带来了意外收获。他在坦克的油箱里发现了5块金锭。\n据估计，这些金锭价值约250万美元。";
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
